#include "TextEditLog.h"

namespace Log {

TextEditLog::TextEditLog() :
	_widget(NULL)
{
}

void TextEditLog::setWidget(QTextEdit* edit)
{
	_widget = edit;
}

void TextEditLog::addLogMessage(QString msg, LogType type)
{
	if(!_widget) return;

	QString typeStr = "";
	switch(type){
		case ILogManager::DEBUG: typeStr = "[DEBUG] "; break;
		case ILogManager::INFO: typeStr = "[INFO] "; break;
		case ILogManager::WARN: typeStr = "[WARN] "; break;
		case ILogManager::ERROR: typeStr = "[ERROR] "; break;
	}

	_widget->append(typeStr + msg);
}

}
